<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>条件渲染</title>
</head>
<script src="./js/react.development.js"></script>
<script src="./js/react-dom.development.js"></script>
<!-- 引入 babel  将jsx语法 转换为 js语法 -->
<script src="./js/babel.min.js"></script>
<style>
    .ad{
        height: 100px;
        background: rgb(77, 75, 223);
        text-align: center;
    }

</style>
<body>
    <div id="root"></div>
</body>
<script type="text/babel">
    //是否是会员
    let isVIP = false;

    //虚拟dom对象
    let vdom;

    // 1. if..else
    if(!isVIP){
        vdom = <div className="ad">这是一段广告!</div>
    }

    // 2、  三元运算符 三目运算符
    vdom = isVIP ? null :  <div className="ad">这是一段广告!</div>

    // 3. 逻辑 与   
    vdom = !isVIP && <div className="ad">这是一段广告!</div>
    

    //渲染
    ReactDOM.render(vdom,document.getElementById("root"));
</script>
</html>